<template>
  <div>
    <el-dialog title="修改" :visible.sync="obj.isshow">
      <el-form :model="form">
        <el-form-item label="手机号" :label-width="formLabelWidth">
          <el-input v-model="form.phone" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="昵称" :label-width="formLabelWidth">
          <el-input v-model="form.nickname" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="密码" :label-width="formLabelWidth">
          <el-input v-model="form.password" autocomplete="off"></el-input>
          <p>留空则不修改</p>
        </el-form-item>
        <el-form-item label="状态" :label-width="formLabelWidth">
          <el-switch
            v-model="form.status"
            :active-value="1"
            :inactive-value="2"
            active-color="#13ce66"
            inactive-color="#ff4949"
          >
          </el-switch>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button   @click="canle">取 消</el-button>
        <el-button type="primary" @click="updata">修改</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { successMsg, failedMsg } from "../../tools/tools.js";
import { memberinfo, memberedit } from "../../request/api.js";
export default {
  props: ["obj"],
  data() {
    return {
      form: {
        uid: "",
        nickname: "",
        phone: "",
        password: "",
        status: 1,
      },
      formLabelWidth: "120px",
    };
  },
  methods: {
    canle(){
      this.$emit('canle')
      this.form={
        uid: "",
            nickname: "",
            phone: "",
            password: "",
            status: 1,
      }
    },
    updata() {
      memberedit(this.form).then((d) => {
        if (d.data.code == 200) {
          successMsg("修改成功");
          this.$emit("updata");
          this.form = {
            uid: "",
            nickname: "",
            phone: "",
            password: "",
            status: 1,
          };
        }
      });
    },
    getMemberInfo(uid) {
      memberinfo({ uid }).then((d) => {
        if (d.data.code == 200) {
          this.form = d.data.list;
        }
      });
    },
  },
};
</script>

<style>
</style>